<?php
/**
 * CONTENIDO extension pack (mpContenidoX), consists of multiple classes to
 * provide more features for Plugins/Modules.
 *
 * @package     mpContenidoX
 * @subpackage  PluginInstaller
 * @author      Murat Purc <murat@purc.de>
 * @copyright   Copyright (c) 2008-2012 Murat Purc (http://www.purc.de)
 * @license     http://www.gnu.org/licenses/gpl-2.0.html - GNU General Public License, version 2
 * @version     $Id: Abstract.class.php 21 2012-07-16 21:33:14Z purcaholic $
 */


defined('CON_FRAMEWORK') or die('Illegal call');


/**
 * Abstact plugin install file reader.
 *
 * @package     mpContenidoX
 * @subpackage  PluginInstaller
 * @author      Murat Purc <murat@purc.de>
 */
abstract class mpPluginInstaller_Reader_Abstract
{
    const MODE_INSTALL   = 'install';
    const MODE_UPDATE    = 'update';
    const MODE_UNINSTALL = 'uninstall';

    /**
     * Plugin meta data
     * @var  mpPluginInstaller_Reader_Abstract
     */
    protected $_metaData = null;

    abstract public function getMetaData();

    abstract public function getSQL($mode);

    abstract public function getRessources($mode);


    protected function _checkMode($mode)
    {
        if ($mode == self::MODE_INSTALL || $mode == self::MODE_UPDATE || $mode == self::MODE_UNINSTALL) {
            return;
        }
        throw new mpPluginInstaller_Exception("Invalid mode $mode");
    }
}
